package usf.gwt.ui.bootstrap.client;

import usf.gwt.ui.bootstrap.client.core.BootstrapContainer;
import usf.gwt.ui.bootstrap.client.core.Constants;

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.HasText;

public class Label extends BootstrapContainer implements HasText {

	public final static String DEFAULT_LABEL_STYLE = "control-label";
	
    public Label() {
    	super();
    }
    
    public Label(String text) {
    	super();
    	setText(text);
    }
    
    @Override
    protected Element initWidget() {
        return DOM.createLabel();
    }
    
    @Override
    protected void initStyle() {
        getElement().addClassName(DEFAULT_LABEL_STYLE);
    }

    public void setFor(String id) {
        getElement().setAttribute(Constants.ATTRIB_FOR, id);
    }
    public String getFor() {
        return getElement().getAttribute(Constants.ATTRIB_FOR);
    }

    @Override
    public String getText() {
        return getElement().getInnerText();
    }
    @Override
    public void setText(String text) {
        getElement().setInnerText(text);
    }

}
